package ofile

import (
	"path/filepath"
	"time"
)

const (
	Img      = "\\img"
	File     = "\\file"
	Music    = "\\music"
	Video    = "\\video"
	bashPath = "..\\..\\Files\\"
)

func MkdirData(basePath string) string {
	//	1.获取当前时间,并且格式化时间
	folderName := time.Now().Format("2006/01/02")
	folderPath := filepath.Join(basePath, folderName)
	//使用mkdirall会创建多层级目录
	//os.MkdirAll(folderPath, os.ModePerm)
	return folderPath + "\\"
}

func MkdirUserInfo(uid, fileType string) (res string) {
	switch fileType {
	case Img:
		res = bashPath + uid + MkdirData(Img)
	case File:
		res = bashPath + uid + MkdirData(File)
	case Video:
		res = bashPath + uid + MkdirData(Video)
	case Music:
		res = bashPath + uid + MkdirData(Video)
	}
	return
}
